
export function loadAMap() {
    let ak = 'exr110xo0sNiGM1swXWhqVZix17T2xT6'
    return new Promise(function(resolve, reject) {
        if (typeof AMap !== 'undefined') {
            resolve(AMap)
            return true
        }
        window.onBMapCallback = function() {
            resolve(AMap)
        }
        let script = document.createElement('script')
        script.type = 'text/javascript'
        script.src = 'http://webapi.amap.com/maps?v=1.3&key=' + ak + '&callback=onBMapCallback'
        script.onerror = reject
        document.head.appendChild(script)
    })
}
